<!--猜你喜欢-->
<template>
  <div class="yourlike">
    <h3>{{ listsz.title }}</h3>

    <div class="block">
      <el-carousel trigger="click" height="244px">
        <el-carousel-item v-for="(item,index) in pages" :key="index">
          <ul>
            <li v-for="ele in item" :key="ele.id" @click="jumpDetails(ele.id, ele.goods_id,item)">
              <img :src="ele.goods_logo">
              <!-- <img v-lazyload="ele.goods_logo" src="@/assets/logo/loading.png"> -->
              <p>{{ ele.goods_title }}</p>
              <!-- <p>{{ ele.describe }}</p> -->
              <p>
                <span>￥ {{ele.selling_price}}</span>
                <s>￥ {{ele.market_price}}</s>
              </p>
            </li>
          </ul>
        </el-carousel-item>
      </el-carousel>
    </div>
  </div>
</template>
<script>
import goods from "../../../assets/images/goods1.png"; // 图片
export default {
  name: "yourLike",

  props: {
    listsz: Object,
    like: Array
  },

  methods: {
    jumpDetails(id, pid,item) {
      this.$router.push({
        name: "productDetails",
        params: {
          id,
          pid,
          item
        }
      })
    }
  },

  computed: {
    pages() {
      const pages = [];
      this.listsz.lists.forEach((item, index) => {
        const page = Math.floor(index / 6);
        if (!pages[page]) {
          pages[page] = [];
        }
        pages[page].push(item);
      });
      return pages;
    }
  }
};
</script>
<style lang="scss" scoped>
.yourlike {
  width: 1200px;
  height: 280px;
  border: 1px solid #dfdfdf;
  margin-top: 50px;
  h3 {
    background-color: #f5f5f5;
    line-height: 36px;
    border-bottom: 1px solid #dfdfdf;
    font-size: 14px;
    color: #454545;
    text-indent: 20px;
  }
  .block {
    ul {
      display: flex;
      flex-direction: row;
      li {
        width: 200px;
        height: 244px;
        cursor: pointer;
        img {
          width: 140px;
          height: 140px;
          margin-top: 20px;
          margin-left: 30px;
          margin-bottom: 10px;
          &:hover {
            opacity: 0.8;
          }
        }
        p {
          box-sizing: border-box;
          width: 100%;
          padding: 5px 20px;
          text-align: center;

          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          span {
            color: red;
            font-size: 14px;
            font-weight: 800;
            padding-right: 5px;
          }
          s {
            color: #ccc;
            font-size: 12px;
          }
        }
      }
    }
  }
}
</style>
